package com.bw.mapper;

import com.bw.domain.Role;
import com.bw.domain.TbMenu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: TaoShiHao
 * @Date: 2025/3/13 10:01
 * @Description:
 **/
public interface RoleMapper {
    @Select("select * from t_menu")
    List<TbMenu> listMenu();

    void addRole(Role role);

    void addRoleMenu(@Param("roleId") Integer id, @Param("menuId") String MenuId);

    void deleteRoleMenu(@Param("id") Integer id);

    @Select("select * from t_role where role_name=#{roleName}")
    Role checkRoleName(String roleName);

    @Select("select menu_id from t_role_menu where role_id=#{roleId}")
    List<Integer> getMenuIdByRoleId(@Param("roleId") Integer id);

    @Update("update t_role set role_name=#{roleName} where id=#{id}")
    void update(Role role);
}
